package display

import (
	"fmt"
	"math/big"
	"strings"
)

// Num is function to display a big.Int number
func Num(in *big.Int) {
	fmt.Println("================================================================================")
	fmt.Println("Number is:")
	fmt.Println("-- DEC BASE 10 ##")
	fmt.Println(in.Text(10))
	fmt.Println("-- HEX BASE 16 ##")
	fmt.Println("0x" + strings.ToUpper(in.Text(16)))
	fmt.Println("-- BIN BASE 2 ##")
	base2 := in.Text(2)
	base2 = strings.Repeat(`0`, ((len(base2)+7)/8)*8-len(base2)) + base2
	i := 0
	for i = 0; i < len(base2)/8; i++ {
		if i != 0 && i%8 == 0 {
			fmt.Println()
		}
		fmt.Print(base2[8*i : 8*i+8])
		fmt.Print(" ")
	}
	fmt.Println("\n================================================================================")
}
